﻿<div ng-controller="tokenUserController">
    <div class="wrapper border-bottom white-bg page-heading">
        <div class="col-lg-pull-12">
            <ol class="breadcrumb">
                <li>管理</li>
            </ol>
        </div>
    </div>

    <form class="form-horizontal row">
        <div class="form-group">
            <div class="col-sm-4">
                <label class="col-sm-5 control-label">会员昵称</label>
                <div class="col-sm-7">
                    <input name="title" type="text" class="form-control input-sm" ng-model="query.name">
                </div>
            </div>
            <div class="col-sm-4">
                <label class="col-sm-4 control-label">手机号</label>
                <div class="col-sm-8">
                    <input name="title" type="text" class="form-control input-sm" ng-model="query.mobile">
                </div>
            </div>
            <div class="col-sm-4">
                <label class="col-sm-4 control-label">姓名</label>
                <div class="col-sm-8">
                    <input name="title" type="text" class="form-control input-sm" ng-model="query.account_name">
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-4">
                <label class="col-sm-4 control-label">身份证号</label>
                <div class="col-sm-8">
                    <input name="title" type="text" class="form-control input-sm" ng-model="query.id_card">
                </div>
            </div>
            <div class="col-sm-4">
                <label class="col-sm-4 control-label">状态</label>
                <div class="col-sm-8">
                    <select name="disabled" class="form-control input-sm" ng-model="query.disabled">
                        <option value="">请选择</option>
                        <option value="0">正常</option>
                        <option value="1">冻结</option>
                    </select>
                </div>
            </div>
            <div class="col-sm-4">
                <label class="col-sm-4 control-label">排序</label>
                <div class="col-sm-8">
                    <div class="col-sm-12">
                        <select name="sort" class="form-control input-sm" ng-model="query.sort">
                            <option value="0">注册时间</option>
                            <option value="1">马力</option>
                        </select>
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-4">
                <label class="col-sm-4 control-label">时间</label>
                <div class="col-sm-8">
                    <div date class="input-group date">
                        <input class="form-control input-sm" ng-model="query.begin_time">
                        <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>

                    </div>
                </div>
            </div>
            <div class="col-sm-4">
                <label class="col-sm-1 control-label">至</label>
                <div class="col-sm-8">
                    <div date class="input-group date">
                        <input class="form-control input-sm" ng-model="query.end_time">
                        <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-4">
                <div class="col-sm-offset-4 col-sm-8">
                    <button class="btn btn-primary btn-sm" ui-sref="app.tokenUser.memberList(query)"><i class="fa fa-search"></i> 查询</button>
                </div>
            </div>
        </div>
    </form>
    <table style="table-layout:fixed;" class="table table-hover m-t-md">
        <thead>
            <tr style="background-color: #f7f7f9;">
                <th>昵称</th>
                <th>手机号</th>
                <th>姓名</th>
                <th>身份证号</th>
                <th>创建时间</th>
                <!--<th>等级</th>-->
                <th>马力值</th>
                <th>红钻数</th>
                <th>邀请码</th>
                <th>邀请数量</th>
                <th>状态</th>
                <th width="150">操作</th>
            </tr>
        </thead>
        <tbody ng-repeat="item in model.rows">
            <tr>
                <td style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;">{{item.name}}</td>
                <td style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;">{{item.mobile}}</td>
                <td style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;">{{item.user_name}}</td>
                <td style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;">{{item.card_no}}</td>
                <td>{{item.create_time}}</td>
                <!--<td>{{item.user_type_title}}</td>-->
                <td>{{item.total_horse_power}}</td>
                <td>{{(item.total_red_drill - item.consume_red_drill).toFixed(6)}}</td>
                <td>{{item.invitation_code}}</td>
                <td>{{item.invitation_num}}</td>
                <td style="{{item.disabled ? 'color:#d3d3d3': 'color:#337ab7'}}">{{item.disabled ? '冻结' : '正常'}}</td>
                <td>
                    <!--<a ng-if="!item.disabled" class="btn btn-primary btn-xs" href="javascript:void(0);" ng-click="updateDisabled(item.merchant_id, 1)"><i class="fa fa-cog"></i> 冻结</a>
                    <a ng-if="item.disabled" class="btn btn-primary btn-xs" href="javascript:void(0);" ng-click="updateDisabled(item.merchant_id, 0)"><i class="fa fa-cog"></i> 激活</a>&nbsp;&nbsp;-->
                    <a class="btn btn-primary btn-xs" ui-sref="app.tokenUser.detail({id:{{item.id}}})"><i class="fa fa-cog"></i> 查看</a>
                    <!--<a class="btn btn-primary btn-xs" href="javascript:;" ng-click="open_increase_horse_power(item)">增加马力</a>-->
                    <!--<a class="btn btn-primary btn-xs" href="javascript:;" ng-click="open_update_parent(item)">修改推荐人</a>-->
                    <!--<a class="btn btn-primary btn-xs" href="javascript:void(0);" ng-click="open_update_user_type(item)">调整等级</a>-->

                </td>
            </tr>
        </tbody>
    </table>
    <div class="row">
        <div class="col-md-12">
            <uib-pagination total-items="model.total_result" items-per-page="model.size" ng-model="model.page" num-pages="model.total_pages"
                            ng-change="search_page(model.page)" class="pagination-sm" boundary-links="true" boundary-link-numbers="true" max-size="20"
                            previous-text="&lsaquo;" next-text="&rsaquo;" first-text="&laquo;" last-text="&raquo;"></uib-pagination>
            <span class="pull-right" style="margin: 30px 0px 20px 0px">共{{model.total_result}} 当前：{{model.page}}/{{model.total_pages}}</span>
        </div>
    </div>


    <script type="text/ng-template" id="increase_horse_power.html">
        <div class="modal-header">
            <h3 class="modal-title">增加马力</h3>
        </div>
        <form name="_form" class="form-horizontal w5c-form" w5c-form-validate="model.validateOptions" role="form" novalidate>
            <div class="modal-body">

                <div class="form-group">
                    <label class="col-sm-2 control-label">增加马力</label>
                    <div class="col-sm-4">
                        <input type="number" name="horsePower" class="form-control input-sm" ng-model="model.increaseHorsePower" step="1" required
                               onkeyup="if(!/^-?\d+$/.test(this.value)){this.value=''}}">
                    </div>
                </div>

            </div>
            <div class="modal-footer">
                <button class="btn btn-primary" type="submit" w5c-form-submit="increaseHorsePower()" btn-loading="psdisabled.save" loading-text="保存中..." ng-disabled="psdisabled.save">
                    确定
                </button>
                <button class="btn btn-primary" type="button" ng-click="cancel()">取消</button>
            </div>
        </form>
    </script>
    <script type="text/ng-template" id="updateParent.html">
        <div class="modal-header">
            <h3 class="modal-title">修改推荐人</h3>
        </div>
        <form name="_form" class="form-horizontal w5c-form" w5c-form-validate="model.validateOptions" role="form" novalidate>
            <div class="modal-body">

                <div class="form-group">
                    <label class="col-sm-3 control-label">推荐人手机号</label>
                    <div class="col-sm-4">
                        <input type="text" name="mobile" class="form-control input-sm" ng-model="model.parentMobile" required>
                    </div>
                </div>

            </div>
            <div class="modal-footer">
                <button class="btn btn-primary" type="submit" w5c-form-submit="updateParent()" btn-loading="psdisabled.save" loading-text="保存中..." ng-disabled="psdisabled.save">
                    确定
                </button>
                <button class="btn btn-primary" type="button" ng-click="cancel()">取消</button>
            </div>
        </form>
    </script>

    <!--<script type="text/ng-template" id="open_update_user_type.html">
        <div class="modal-header">
            <h3 class="modal-title">调整等级</h3>
        </div>
        <form name="_form" class="form-horizontal w5c-form" w5c-form-validate="model.validateOptions" role="form" novalidate>
            <div class="modal-body">

                <div class="form-group">
                    <label class="col-sm-2 control-label">等级</label>
                    <div class="col-sm-4">
                        <select name="type" class="form-control input-sm" ng-model="model.user_type_value" required>
                            <option value="3">普通用户</option>
                            <option value="6">创客</option>
                            <option value="7">节点商城</option>
                            <option value="8">县代理</option>
                            <option value="9">市代理</option>
                        </select>
                    </div>
                </div>

            </div>
            <div class="modal-footer">
                <button class="btn btn-primary" type="submit" w5c-form-submit="updateUserType()" btn-loading="psdisabled.save" loading-text="保存中..." ng-disabled="psdisabled.save">
                    确定
                </button>
                <button class="btn btn-primary" type="button" ng-click="cancel()">取消</button>
            </div>
        </form>
    </script>-->
</div>
